
module frv_ibuf_entry (
    input                   clk             ,
    input                   rst_n           ,
    // Program Downloader reset
    input                   pd_rst          ,

    input                   ibe_req         ,
    input                   ibe_flush       ,
    // Entry Data input
    input [31:0]            ibe_inst_data_i ,
    input [31:0]            ibe_pc_data_i   ,
    input                   ibe_exp_vld_i   ,
    input [4:0]             ibe_exp_code_i  ,
    input [31:0]            ibe_bp_taddr_i  ,
    input                   ibe_bp_taken_i  ,
    input [3:0]             ibe_bp_bhtv_i   , // BHT Entry Value
    input [31:0]            ibe_bp_phtv_i   ,  // PHT Entry Value
    //Entry Data Output
    output                  ibe_vld_o       ,
    output [31:0]           ibe_inst_data_o ,
    output [31:0]           ibe_pc_data_o   ,
    output                  ibe_exp_vld_o   ,
    output [4:0]            ibe_exp_code_o  ,
    output [31:0]           ibe_bp_taddr_o  ,
    output                  ibe_bp_taken_o  ,
    output [3:0]            ibe_bp_bhtv_o   , // BHT Entry Value
    output [31:0]           ibe_bp_phtv_o     // PHT Entry Value
);

wire ibe_vld_wren;
wire ibe_vld_i;

assign ibe_vld_wren = ibe_req || ibe_flush ;
assign ibe_vld_i    = ibe_req && ~ibe_flush;

dffr #(1)  ibe_vld_ff          (clk,rst_n,ibe_vld_wren,ibe_vld_i        ,ibe_vld_o       );
dffr #(32) ibe_inst_data_ff    (clk,rst_n,ibe_req,     ibe_inst_data_i  , ibe_inst_data_o); 
dffr #(32) ibe_pc_data_ff      (clk,rst_n,ibe_req,     ibe_pc_data_i    , ibe_pc_data_o  ); 
dffr #(1)  ibe_exp_vld_ff      (clk,rst_n,ibe_req,     ibe_exp_vld_i    , ibe_exp_vld_o  );
dffr #(5)  ibe_exp_code_ff     (clk,rst_n,ibe_req,     ibe_exp_code_i   , ibe_exp_code_o );
dffr #(32) ibe_bp_taddr_ff     (clk,rst_n,ibe_req,     ibe_bp_taddr_i   , ibe_bp_taddr_o ); 
dffr #(1)  ibe_bp_taken_ff     (clk,rst_n,ibe_req,     ibe_bp_taken_i   , ibe_bp_taken_o );
dffr #(4)  ibe_bp_bhtv_ff      (clk,rst_n,ibe_req,     ibe_bp_bhtv_i    , ibe_bp_bhtv_o  );
dffr #(32) ibe_bp_phtv_ff      (clk,rst_n,ibe_req,     ibe_bp_phtv_i    , ibe_bp_phtv_o  ); 

endmodule

